dnl Process this file with autoconf to produce a configure script. -*-m4-*-
AC_INIT(src/fold.c)
AM_CONFIG_HEADER(config.h)
AC_PREREQ(2.13)               dnl Minimum Autoconf version required.
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([textutils], [2.0])

# Enable GNU extensions.
# Define this here, not in acconfig's @TOP@ section, since definitions
# in the latter don't make it into the configure-time tests.
AC_DEFINE([_GNU_SOURCE])

ALL_LINGUAS="cs de el es fr ko nl no pl ru sk sv zh"

dnl Checks for programs.

jm_PERL dnl requires perl5.003 or better
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
AC_PROG_RANLIB
AC_AIX
AC_MINIX

dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
dnl whether functions and headers are available, whether they work, etc.
AC_SYS_LARGEFILE

dnl This test must precede tests of compiler characteristics like
dnl that for the inline keyword, since it may change the degree to
dnl which the compiler supports such features.
AM_C_PROTOTYPES

dnl Checks for header files.
AC_CHECK_HEADERS(fcntl.h float.h limits.h memory.h stdlib.h string.h \
                 unistd.h values.h)
AC_HEADER_STAT
AC_HEADER_STDC

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_BIGENDIAN
AC_C_CONST
AC_C_INLINE
AC_C_LONG_DOUBLE

AC_HEADER_DIRENT
AC_STRUCT_ST_BLKSIZE

jm_CHECK_ALL_TYPES

dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])

dnl Checks for library functions.
AC_CHECK_FUNCS(fseeko isascii mempcpy strchr strerror strrchr)
AC_FUNC_ALLOCA

jm_MACROS
jm_FUNC_STRFTIME

AC_FUNC_VPRINTF
AC_REPLACE_FUNCS(memcpy memset stpcpy strpbrk strtol strtoul)

AM_FUNC_STRTOD
AC_SUBST(POW_LIBM)
test $am_cv_func_strtod_needs_libm = yes && POW_LIBM=-lm

AM_FUNC_ERROR_AT_LINE

AC_CHECK_FUNCS(nl_langinfo)
AC_CHECK_HEADERS(langinfo.h)

AM_GNU_GETTEXT

# This is necessary so that .o files in LIBOBJS are also built via
# the ANSI2KNR-filtering rules.
LIBOBJS=`echo $LIBOBJS|sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'`

AC_OUTPUT([Makefile
	   doc/Makefile
	   intl/Makefile
	   lib/Makefile
	   man/Makefile
	   m4/Makefile
	   po/Makefile.in
	   src/Makefile
	   djgpp/Makefile
	   tests/Makefile
	   tests/cut/Makefile
	   tests/head/Makefile
	   tests/join/Makefile
	   tests/md5sum/Makefile
	   tests/pr/Makefile
	   tests/sort/Makefile
	   tests/tac/Makefile
	   tests/tail/Makefile
	   tests/tr/Makefile
	   tests/uniq/Makefile
	   tests/wc/Makefile
	  ])
